import request from '@/request'

const API = {
	list: '/api/device/deviceList',
	organizationList: '/api/personal/organizationList',
	deviceInfo: '/api/device/device_info',
	devicePatrol: '/api/device/devicePatrol',
	deviceInstall: '/api/device/deviceInstall',
	patrolDetails: '/api/device/PatrolInfo',
	valDevicePwd: '/api/device/valDevicePwd',
	valUserDevice: '/api/device/valUserDevice'
}

export const fetchEquipmentList = data =>
	request({
		url: API.list,
		data
	})

export const fetchOrganizationList = () =>
	request({
		url: API.organizationList
	})

/**获取机箱序列号 */
export const fetchDeviceInfo = host_serial_no =>
	request({
		url: API.deviceInfo,
		data: {
			host_serial_no
		}
	}, false)

export const postDevicePatrol = data => request({
	url: API.devicePatrol,
	data
})

export const fetchDeviceInstall = data =>
	request({
		url: API.deviceInstall,
		data
	})

export const fetchDevicePatrolDetails = (user_id, host_serial_no) =>
	request({
		url: API.patrolDetails,
		data: {
			user_id,
			host_serial_no
		}
	})

export const valDevicePwd = (data) => {
	return request({
		url: API.valDevicePwd,
		data: data
	})
}
export const valUserDevice = (data) => {
	return request({
		url: API.valUserDevice,
		data: data
	})
}